
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:xsdk_flutter/xsdk/xsdk_flutter_package.dart';

/*
系统设置
 */
class PageStateReabamCloudPrivacy extends XPageState{

  String tag;
  PageStateReabamCloudPrivacy(this.tag);

  String totalText='';

  @override
  Widget getBodyWidget(BuildContext context) {
    return XWidgetUtils.getLayoutSingleChildScrollView(
      child: XWidgetUtils.getWidgetText(
          totalText,
          style: XStyleUtils.textStyle_333_14(),
        padding: XWidgetUtils.getEdgeInsets(15, 15, 15, 15)
      ),
    );
  }

  @override
  Color getXPageBackgroundColor() {
    return Colors.white;
  }

  @override
  void onStart() {
    if('服务协议'==tag){
      setXTitle(titleText: '服务协议');
    }else{
      setXTitle(titleText: '隐私协议');
    }
  }

  @override
  Future<void> updateData({int pageIndex=1}) async {
    try{
      if('服务协议'==tag){
        XFileUtils.readAssetsTextFile(
            context,
            'assets/reabam_cloud_privacy/reabam_cloud_user_service.txt').then(
                (String value){
                  setState(() {
                    totalText=value;
                  });
            }
        );
      }else{
        XFileUtils.readAssetsTextFile(
            context,
            'assets/reabam_cloud_privacy/reabam_cloud_privacy.txt').then(
                (String value){
              setState(() {
                totalText=value;
              });
            }
        );
      }
    }catch(e){
      XLogUtils.printLog('$e');
    }

  }



}